package com.sumainfor.wx.tenant.service.impl;

import com.sumainfor.common.util.JsonResult;
import com.sumainfor.common.utlis.AuthUtil;
import com.sumainfor.common.utlis.ComUtils;
import com.sumainfor.common.utlis.ParamsCommon;
import com.sumainfor.common.wechat.WeChatConfig;
import com.sumainfor.wx.tenant.dao.WechatMapper;
import com.sumainfor.wx.tenant.dao.ZfeignMapper;
import com.sumainfor.wx.tenant.feign.DevelopmentFeignClient;
import com.sumainfor.wx.tenant.feign.MarketFeignClient;
import com.sumainfor.wx.tenant.service.WechatService;
import com.sumainfor.wx.tenant.service.ZfeignService;
import net.sf.json.JSONObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.transaction.interceptor.TransactionAspectSupport;

import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.locks.ReentrantLock;

/**
 * pc端调用微信租客端
 */
@Service
public class ZfeignServiceimpl implements ZfeignService {

    private ReentrantLock lock = new ReentrantLock(false);
    Logger log = LoggerFactory.getLogger(ZfeignServiceimpl.class);

    @Autowired
    ZfeignMapper zfeignMapper;
    /**
     * 签约时根据手机号查询微信端的租客信息
     */
    @Override
    public Map<String, Object> getTenantByTenPhone(Map<String, Object> params) {
        Map<String,Object> map=zfeignMapper.getTenantByTenPhone(params);
        if (map==null){
            map=new HashMap<String,Object>();
            map.put("TenCount",0);//TenCount 0 查询不到租客的信息 1.查询到租客的信息
        }else{
            map.put("TenCount",1);
        }
        return map;
    }

    @Override
    public Map<String, Object> getTenId(Map<String, Object> params) {
        return zfeignMapper.getTenId(params);
    }
}
